package com.meng.jingtao.member.feign;

import com.meng.common.utils.R;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author xinqimeng
 * @version 1.0.0
 * @ClassName CouponFeignServiceFallbackFactory.java
 * @Description TODO
 * @createTime 2021年12月29日 18:31:00
 */
@Component
public class CouponFeignServiceFallbackFactory implements FallbackFactory<CouponFeignService> {
    @Override
    public CouponFeignService create(Throwable throwable) {
        if (!(throwable.getClass() != RuntimeException.class && throwable.getMessage() == null)) {
            throwable.printStackTrace();
        }
        CouponFeignService fallBack = new CouponFeignService() {
            @Override
            public R memberCoupons() {
                System.out.println("查询会员列表失败,进入服务消费者降级处理");
                return R.error("查询会员列表失败,进入服务消费者降级处理!");
            }
        };
        return fallBack;
    }
}
